package model

import (
	"time"
	
	"gorm.io/gorm"
)

type User struct {
	ID         uint   `gorm:"primarykey;autoIncrement"`
	Username   string `gorm:"column:username;type:string;size:30;uniqueIndex;not null;comment:用户名"`
	Email      string `gorm:"column:email;type:string;size:30;uniqueIndex;comment:邮箱"`
	Nickname   string `gorm:"column:nickname;type:string;size:20;comment:昵称"`
	Password   string `gorm:"column:password;type:string;size:32;not null;comment:用户密码"`
	Salt       string `gorm:"column:salt;type:string;size:6;not null;comment:盐值"`
	Status     bool   `gorm:"column:status;type:bool;not null;default:true;index:idx_user_status;comment:用户状态"`
	RegisterIp string `gorm:"column:register_ip;type:string;size:15;comment:注册ip"`
	CreatedAt  time.Time
	UpdatedAt  time.Time
	DeletedAt  gorm.DeletedAt `gorm:"index"`
}

// TableName 设置表名
func (User) TableName() string {
	return "fiber_user"
}
